import Vue from "vue";
import Router from 'vue-router'
import Login from './views/login'
import Admin from './views/admin'
import Welcome from './views/admin/welcome'
import Category from './views/admin/category'
import Course from './views/admin/course'
import Chapter from './views/admin/chapter'
import Section from './views/admin/section'
import Teacher from './views/admin/teacher'
import File from './views/admin/file'
import Content from './views/admin/content'
import User from './views/admin/user'
import Resource from './views/admin/resource'
import Role from './views/admin/role'

Vue.use(Router)

export default new Router({
  mode: 'history',
  base: process.env.BASE_URL,
  routes: [{
    path: '',
    redirect: '/login'
  },
    {
      name: '/login',
      path: '/login',
      component: Login
    },
    {
      path: '/',
      name: 'admin',
      component: Admin,
      meta:{
        loginRequire: true
      },
      children: [
        {
          name: 'welcome',
          path: 'welcome',
          component: Welcome
        },
        {
          name: 'business/category',
          path: 'business/category',
          component: Category
        },
        {
          name: 'business/course',
          path: 'business/course',
          component: Course
        },
        {
          name: 'business/chapter',
          path: 'business/chapter',
          component: Chapter
        },
        {
          name: 'business/section',
          path: 'business/section',
          component: Section
        },
        {
          name: 'business/content',
          path: 'business/content',
          component: Content
        },
        {
          name: 'business/teacher',
          path: 'business/teacher',
          component: Teacher
        },
        {
          name: 'file/file',
          path: 'file/file',
          component: File
        },
        {
          name: 'system/user',
          path: 'system/user',
          component: User
        }
        ,
        {
          name: 'system/resource',
          path: 'system/resource',
          component: Resource
        }
        ,
        {
          name: 'system/role',
          path: 'system/role',
          component: Role
        }
      ]
    }
  ]
})
